<?php

namespace app\admin\controller;

use think\Controller;

class System extends Controller
{
    //
    public function index()
    {
        if (request()->isAjax()) {
            $data   = input('post.');
            $result = model('system')->save($data, ['id' => 2]);
            if ($result) {
                $this->success('更新成功', 'admin/system/index');
            } else {
                $this->error('更新失败');
            }
        }
        $systemInfo = model('System')->find(2);
        $viewData   = [
            'system' => $systemInfo
        ];
        $this->assign($viewData);
        return $this->fetch();
    }
}
